package com.jcl.emessage.email.service;

import com.jcl.emessage.core.config.EmailConfig;
import com.jcl.emessage.core.handler.SendEmailHandler;
import com.jcl.emessage.core.vo.MailMessageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName SendEmailProxy
 * @Description TODO
 * @Author yyliu
 * @Date 2018/11/12 11:09
 * @Version 1.0
 **/
@Service
public class SendEmailService {

    @Autowired
    private SendEmailHandler sendEmailHandler;


    @Autowired
    private EmailConfig emailConfig;

    public void sendHtmlMail(MailMessageVo mailMessageVo) {
        mailMessageVo.setFrom(emailConfig.getFromAddr());
        sendEmailHandler.sendHtmlMail(mailMessageVo);
    }

    public void send(MailMessageVo mailMessageVo) {

        mailMessageVo.setFrom(emailConfig.getFromAddr());
        sendEmailHandler.sendAttachmentMail(mailMessageVo);
    }
}
